import { legacy_createStore, applyMiddleware } from "redux";
// 引入saga异步库
import createSagaMiddleware from "redux-saga";

import reducer from "./reducer";
import mySaga from "./sagas";

// 引入的redux-saga是一个函数，要将函数的返回值作为applyMiddleware的参数
const sagaMiddleware = createSagaMiddleware();

const store = legacy_createStore(reducer, applyMiddleware(sagaMiddleware));

sagaMiddleware.run(mySaga);
export default store;
